<script setup>
import { DesignConfiguration, Main } from './components';
import adapter from './utils/handlePlatform/adapter';

const { onMounted, reactive, useAttrs } = Vue3;

const props = defineProps({
  type: String,
});
const attrs = useAttrs();

const renderhMap = {
  main: Main,
  designConfiguration: DesignConfiguration,
};

let newProps = reactive({ ...props, ...attrs });

onMounted(() => {
  newProps.eventBus?.on(newP => {
    newProps = adapter(newP);
  });
});
</script>

<template>
  <component :is="renderhMap[props.type || 'main']" v-bind="newProps" />
</template>
